package top.kaoshanji.p2ch19a;

/**
 * 代码清单-p2ch19a-536页a：设置ThreadLocal初始值
 * author kaoshanji
 * ^_^
 * create time 2025/2/28 10:40
 */
public class ThreadLocalInit {

    static ThreadLocal<Integer> local = new ThreadLocal<Integer>() {

        @Override
        protected Integer initialValue() {
            return 100;
        }
    };

    public static void main(String[] args) {

        System.out.println(local.get());

        local.set(200);
        local.remove();

        System.out.println(local.get());

    }

}
